define cassandra::tzfile($path, $tarpath, $source = '', $tar_name = '') {

    $local_tar_name = $tar_name ?{
      '' => $title,
      default => $tar_name,
    }

    $local_source = $source ?{
      '' => "puppet:///modules/cassandra/${local_tar_name}",
      default => $source,
    }

    $tar_place_path = "${tarpath}/${local_tar_name}"
    #only work for *nix
    $tar_cmd = '/bin/tar'
    $rm_cmd = '/bin/rm'


    # download the tgz file
    file { "$path":
	ensure => directory,
	mode => 0770,
    }
 
    file { "$tar_place_path":
        ensure => present,
        source  => $local_source,
#	checksum => mtime,
	replace => false,
    }

    # untar the tarball at the desired location
    exec { "untar $title":
        command => "${rm_cmd} -rf ${path}/*; ${tar_cmd} xzf ${tar_place_path} -C ${path}",
        refreshonly => true,
	subscribe => File["$tar_place_path"],
	require => File["$path"],
    }
}

